package com.ruoyi.controller;


import com.ruoyi.constants.Constant;
import com.ruoyi.dto.*;
import com.ruoyi.edu.domain.Risk;
import com.ruoyi.edu.service.IRiskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Api(tags = "风险评估")
@RequestMapping("/riskEvaluate")
@RestController
public class RiskEvaluateController {

    @Autowired
    private IRiskService riskService;

    private static Map<String,String> dtDictMap = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap1 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap2 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap3 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap4 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap5 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap6 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap7 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap8 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap9 = new HashMap<String,String>();//电梯模型
    private static Map<String,String> dtDictMap10 = new HashMap<String,String>();//电梯模型

    private static Map<String,String> rqgwDictMap = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap1 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap2 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap3 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap4 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap5 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap6 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap7 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap8 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap9 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap10 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap11 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap12 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap13 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap14 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap15 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap16 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap17 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap18 = new HashMap<String,String>();//燃气管网模型
    private static Map<String,String> rqgwDictMap19 = new HashMap<String,String>();//燃气管网模型

    private static Map<String,String> gsgwDictMap = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap1 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap2 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap3 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap4 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap5 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap6 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap7 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap8 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap9 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap10 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap11 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap12 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap13 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap14 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap15 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap16 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap17 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap18 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap19 = new HashMap<String,String>();//供水管网模型
    private static Map<String,String> gsgwDictMap20 = new HashMap<String,String>();//供水管网模型

    private static Map<String,String> rlgwDictMap = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap1 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap2 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap3 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap4 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap5 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap6 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap7 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap8 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap9 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap10 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap11 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap12 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap13 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap14 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap15 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap16 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap17 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap18 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap19 = new HashMap<String,String>();//热力管网模型
    private static Map<String,String> rlgwDictMap20 = new HashMap<String,String>();//热力管网模型

    private static Map<String,String> qlDictMap = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap1 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap2 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap3 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap4 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap5 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap6 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap7 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap8 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap9 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap10 = new HashMap<String,String>();//桥梁模型
    private static Map<String,String> qlDictMap11 = new HashMap<String,String>();//桥梁模型

    private static Map<String,String> jzxfDictMap = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap1 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap2 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap3 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap4 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap5 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap6 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap7 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap8 = new HashMap<String,String>();//建筑消防模型
    private static Map<String,String> jzxfDictMap9 = new HashMap<String,String>();//建筑消防模型

    private static Map<String,String> jtDictMap = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap1 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap2 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap3 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap4 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap5 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap6 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap7 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap8 = new HashMap<String,String>();//交通模型
    private static Map<String,String> jtDictMap9 = new HashMap<String,String>();//交通模型

    private static Map<String,String> psgwDictMap = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap1 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap2 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap3 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap4 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap5 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap6 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap7 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap8 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap9 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap10 = new HashMap<String,String>();//排水管网
    private static Map<String,String> psgwDictMap11 = new HashMap<String,String>();//排水管网

    private static Map<String,String> stationDictMap = new HashMap<String,String>();//场站
    private static Map<String,String> stationDictMap1 = new HashMap<String,String>();//场站
    private static Map<String,String> stationDictMap2 = new HashMap<String,String>();//场站
    private static Map<String,String> stationDictMap3 = new HashMap<String,String>();//场站
    private static Map<String,String> stationDictMap4 = new HashMap<String,String>();//场站
    private static Map<String,String> stationDictMap5 = new HashMap<String,String>();//场站


    private static Map<String,String> stationComprehensiveDictMap = new HashMap<String,String>();//场站综合
    private static Map<String,String> stationComprehensiveDictMap1 = new HashMap<String,String>();//场站综合
    private static Map<String,String> stationComprehensiveDictMap2 = new HashMap<String,String>();//场站综合
    private static Map<String,String> stationComprehensiveDictMap3 = new HashMap<String,String>();//场站综合
    private static Map<String,String> stationComprehensiveDictMap4 = new HashMap<String,String>();//场站综合
    private static Map<String,String> stationComprehensiveDictMap5 = new HashMap<String,String>();//场站综合
    private static Map<String,String> stationComprehensiveDictMap6 = new HashMap<String,String>();//场站综合

    private static Map<String,String> enterpriseComprehensiveDictMap = new HashMap<String,String>();//企业综合
    private static Map<String,String> enterpriseComprehensiveDictMap1 = new HashMap<String,String>();//企业综合
    private static Map<String,String> enterpriseComprehensiveDictMap2 = new HashMap<String,String>();//企业综合
    private static Map<String,String> enterpriseComprehensiveDictMap3 = new HashMap<String,String>();//企业综合
    private static Map<String,String> enterpriseComprehensiveDictMap4 = new HashMap<String,String>();//企业综合
    private static Map<String,String> enterpriseComprehensiveDictMap5 = new HashMap<String,String>();//企业综合



    static {
        /*--------------------电梯模型start------------------*/
        dtDictMap.put("yxnd","40~15~5#10#20");
        dtDictMap.put("dtjs","40~20~0#10#20");
        dtDictMap.put("szjz","40~30~10#20#30#5");
        dtDictMap.put("jzwc","40~20~5#10#20");
        dtDictMap.put("dtlx","40~5~10#5");
        dtDictMap.put("sfaz","60~20~20#5");
        //dtDictMap.put("jlsy","60~10~5#15#30");
        dtDictMap.put("sfbj","60~40~0#10");
        dtDictMap.put("sfkr","60~20~0#30");
        dtDictMap.put("bjcz","60~20~10#30");

        dtDictMap1.put("yxnd","40~15~5#10#20");
        dtDictMap2.put("dtjs","40~20~0#10#20");
        dtDictMap3.put("szjz","40~30~10#20#30#5");
        dtDictMap4.put("jzwc","40~20~5#10#20");
        dtDictMap5.put("dtlx","40~5~10#5");
        dtDictMap6.put("sfaz","60~20~20#5");
        //dtDictMap7.put("jlsy","60~10~5#15#30");
        dtDictMap8.put("sfbj","60~40~0#10");
        dtDictMap9.put("sfkr","60~20~0#30");
        dtDictMap10.put("bjcz","60~20~10#30");

        /*--------------------电梯模型end------------------*/

        /*--------------------燃气管网模型start------------------*/
        //rqgwDictMap.put("gwjb_gl","20~30~5#10#20#30#15#5#10#20#5#15#20#");
        rqgwDictMap.put("gwjb_gl","20~10~5#10#20");
        rqgwDictMap.put("gwjb_gc","20~10~30#15#5#10");
        rqgwDictMap.put("gwjb_ms","20~5~20#5#15");
        rqgwDictMap.put("gwjb_gdss","20~5~20#0");
        rqgwDictMap.put("zrph_jscz","20~15~20#0");
        rqgwDictMap.put("zrph_gdzb","20~15~20#0");
        rqgwDictMap.put("rlph_gdsz","20~15~5#10#20");
        rqgwDictMap.put("rlph_gdsf","20~10~30#20#10#0");
        rqgwDictMap.put("rlph_gdfh","20~15~20#5#0");
        rqgwDictMap.put("zbwm","30~30~30#5");
        rqgwDictMap.put("yldj","30~10~30#15#5");
        rqgwDictMap.put("zbwb","30~30~5#10#30");
        rqgwDictMap.put("szlw","30~10~5#10");
        rqgwDictMap.put("szqy","30~10~5#10#15");
        rqgwDictMap.put("szqyjj","30~10~5#10#15");
        rqgwDictMap.put("jsnd","50~10~10#30#0");
        rqgwDictMap.put("xlhd","50~30~0#10");
        rqgwDictMap.put("zbrq","50~30~20#0");
        rqgwDictMap.put("bjcz","50~30~10#30");

        rqgwDictMap1.put("gwjb_gl","20~10~5#10#20");
        rqgwDictMap2.put("gwjb_gc","20~10~30#15#5#10");
        rqgwDictMap3.put("gwjb_ms","20~5~20#5#15");
        rqgwDictMap4.put("gwjb_gdss","20~5~20#0");
        rqgwDictMap5.put("zrph_jscz","20~15~20#0");
        rqgwDictMap6.put("zrph_gdzb","20~15~20#0");
        rqgwDictMap7.put("rlph_gdsz","20~15~5#10#20");
        rqgwDictMap8.put("rlph_gdsf","20~10~30#20#10#0");
        rqgwDictMap9.put("rlph_gdfh","20~15~20#5#0");
        rqgwDictMap10.put("zbwm","30~30~30#5");
        rqgwDictMap11.put("yldj","30~10~30#15#5");
        rqgwDictMap12.put("zbwb","30~30~5#10#30");
        rqgwDictMap13.put("szlw","30~10~5#10");
        rqgwDictMap14.put("szqy","30~10~5#10#15");
        rqgwDictMap15.put("szqyjj","30~10~5#10#15");
        rqgwDictMap16.put("jsnd","50~10~10#30#0");
        rqgwDictMap17.put("xlhd","50~30~0#10");
        rqgwDictMap18.put("zbrq","50~30~20#0");
        rqgwDictMap19.put("bjcz","50~30~10#30");

        /*--------------------燃气管网模型end------------------*/

        /*--------------------供水管网模型start------------------*/
        gsgwDictMap.put("gwjb_gl","20~10~5#10#20");
        gsgwDictMap.put("gwjb_gc","20~10~5#15#5#30");
        gsgwDictMap.put("gwjb_ms","20~5~20#5#15");
        gsgwDictMap.put("gwjb_gdss","20~5~20#0");
        gsgwDictMap.put("zrph_jscz","20~15~20#0");
        gsgwDictMap.put("zrph_gdzb","20~15~20#0");
        gsgwDictMap.put("rlph_gdsz","20~15~5#10#20");
        gsgwDictMap.put("rlph_gdsf","20~10~30#20#10#0");
        gsgwDictMap.put("rlph_gdfh","20~15~20#5#0");
        gsgwDictMap.put("szlw","30~20~10#20");
        gsgwDictMap.put("szqy","30~10~0#5#10");
        gsgwDictMap.put("szqyjj","30~10~0#5#10");
        gsgwDictMap.put("gj","30~30~5#10#30");
        gsgwDictMap.put("jj","30~20~20#5");
        gsgwDictMap.put("zbsg","30~10~5#10#15");
        gsgwDictMap.put("jsnd","50~10~10#30#0");
        gsgwDictMap.put("xlhd","50~20~0#10");
        gsgwDictMap.put("zbyl","50~20~20#0");
        gsgwDictMap.put("gdsl","50~20~20#0");
        gsgwDictMap.put("bjcz","50~30~10#30");

        gsgwDictMap1.put("gwjb_gl","20~10~5#10#20");
        gsgwDictMap2.put("gwjb_gc","20~10~5#15#5#30");
        gsgwDictMap3.put("gwjb_ms","20~5~20#5#15");
        gsgwDictMap4.put("gwjb_gdss","20~5~20#0");
        gsgwDictMap5.put("zrph_jscz","20~15~20#0");
        gsgwDictMap6.put("zrph_gdzb","20~15~20#0");
        gsgwDictMap7.put("rlph_gdsz","20~15~5#10#20");
        gsgwDictMap8.put("rlph_gdsf","20~10~30#20#10#0");
        gsgwDictMap9.put("rlph_gdfh","20~15~20#5#0");
        gsgwDictMap10.put("szlw","30~20~10#20");
        gsgwDictMap11.put("szqy","30~10~0#5#10");
        gsgwDictMap12.put("szqyjj","30~10~0#5#10");
        gsgwDictMap13.put("gj","30~30~5#10#30");
        gsgwDictMap14.put("jj","30~20~20#5");
        gsgwDictMap15.put("zbsg","30~10~5#10#15");
        gsgwDictMap16.put("jsnd","50~10~10#30#0");
        gsgwDictMap17.put("xlhd","50~20~0#10");
        gsgwDictMap18.put("zbyl","50~20~20#0");
        gsgwDictMap19.put("gdsl","50~20~20#0");
        gsgwDictMap20.put("bjcz","50~30~10#30");

        /*--------------------供水管网模型end------------------*/

        /*--------------------供水管网模型start------------------*/
        psgwDictMap.put("wxxyxyz_dx","55~20~50#40#20#10#5");
        psgwDictMap.put("wxxyxyz_dmgc","55~15~50#40#30#15#5");
        psgwDictMap.put("wxxyxyz_dmpd","55~15~10#20#30#40#50#60");
        psgwDictMap.put("wxxyxyz_dmstx","55~15~10#20#30#40#50");
        psgwDictMap.put("wxxyxyz_sx","55~15~50#40#30#25#10");
        psgwDictMap.put("wxxyxyz_psgw","55~15~5#20#30");
        psgwDictMap.put("blxyxyz_rkmd","35~50~0#5#10");
        psgwDictMap.put("blxyxyz_jjmd","35~50~0#5#10");
        psgwDictMap.put("crxyxyz_yynl","10~40~30#0");
        psgwDictMap.put("crxyxyz_fznl","10~30~30#0");
        psgwDictMap.put("crxyxyz_jhnl","10~30~20#0");

        psgwDictMap1.put("wxxyxyz_dx","55~20~50#40#20#10#5");
        psgwDictMap2.put("wxxyxyz_dmgc","55~15~50#40#30#15#5");
        psgwDictMap3.put("wxxyxyz_dmpd","55~15~10#20#30#40#50#60");
        psgwDictMap4.put("wxxyxyz_dmstx","55~15~10#20#30#40#50");
        psgwDictMap5.put("wxxyxyz_sx","55~15~50#40#30#25#10");
        psgwDictMap6.put("wxxyxyz_psgw","55~15~5#20#30");
        psgwDictMap7.put("blxyxyz_rkmd","35~50~0#5#10");
        psgwDictMap8.put("blxyxyz_jjmd","35~50~0#5#10");
        psgwDictMap9.put("crxyxyz_yynl","10~40~30#0");
        psgwDictMap10.put("crxyxyz_fznl","10~30~30#0");
        psgwDictMap11.put("crxyxyz_jhnl","10~30~20#0");

        /*--------------------供水管网模型end------------------*/

        /*--------------------热力管网模型start------------------*/
        rlgwDictMap.put("gwjb_gl","20~10~5#10#20");
        rlgwDictMap.put("gwjb_ms","20~10~20#5#15");
        rlgwDictMap.put("gwjb_gdss","20~10~20#0");
        rlgwDictMap.put("zrph_jscz","20~15~20#0");
        rlgwDictMap.put("zrph_gdzb","20~15~20#0");
        rlgwDictMap.put("rlph_gdsz","20~15~5#10#20");
        rlgwDictMap.put("rlph_gdsf","20~10~30#20#10#0");
        rlgwDictMap.put("rlph_gdfh","20~15~20#5#0");
        rlgwDictMap.put("szlw","30~20~10#20");
        rlgwDictMap.put("szqy","30~10~0#5#10");
        rlgwDictMap.put("szqyjj","30~10~0#5#10");
        rlgwDictMap.put("gj","30~10~5#10#30");
        rlgwDictMap.put("yldj","30~20~5#10#30");
        rlgwDictMap.put("jj","30~20~20#0");
        rlgwDictMap.put("zbyb","30~30~5#10#30");
        rlgwDictMap.put("zbsg","30~10~5#10#15");
        rlgwDictMap.put("jsnd","50~10~10#30#0");
        rlgwDictMap.put("xlhd","50~30~0#10");
        rlgwDictMap.put("zbyl","50~30~20#0");
        rlgwDictMap.put("bjcz","50~30~10#30");

        rlgwDictMap1.put("gwjb_gl","20~10~5#10#20");
        rlgwDictMap2.put("gwjb_ms","20~10~20#5#15");
        rlgwDictMap3.put("gwjb_gdss","20~10~20#0");
        rlgwDictMap4.put("zrph_jscz","20~15~20#0");
        rlgwDictMap5.put("zrph_gdzb","20~15~20#0");
        rlgwDictMap6.put("rlph_gdsz","20~15~5#10#20");
        rlgwDictMap7.put("rlph_gdsf","20~10~30#20#10#0");
        rlgwDictMap8.put("rlph_gdfh","20~15~20#5#0");
        rlgwDictMap9.put("szlw","30~20~10#20");
        rlgwDictMap10.put("szqy","30~10~0#5#10");
        rlgwDictMap11.put("szqyjj","30~10~0#5#10");
        rlgwDictMap12.put("gj","30~10~5#10#30");
        rlgwDictMap13.put("yldj","30~20~5#10#30");
        rlgwDictMap14.put("jj","30~20~20#0");
        rlgwDictMap15.put("zbyb","30~30~5#10#30");
        rlgwDictMap16.put("zbsg","30~10~5#10#15");
        rlgwDictMap17.put("jsnd","50~10~10#30#0");
        rlgwDictMap18.put("xlhd","50~30~0#10");
        rlgwDictMap19.put("zbyl","50~30~20#0");
        rlgwDictMap20.put("bjcz","50~30~10#30");
        /*--------------------热力管网模型end------------------*/

        /*--------------------桥梁模型start------------------*/
        qlDictMap.put("qxsf","20~25~30#0");
        qlDictMap.put("szdl","20~20~30#20#10#5");
        qlDictMap.put("zbsg","20~20~5#10#20");
        qlDictMap.put("yxnd","20~15~20#5#20");
        qlDictMap.put("jlzh","20~20~5#10#20");
        qlDictMap.put("qmcd","30~50~10#20");
        qlDictMap.put("qlsz","30~50~30#20#10#5");
        qlDictMap.put("sfaz","50~20~30#0");
        qlDictMap.put("dqjc","50~30~0#30");
        qlDictMap.put("bjcz","50~30~10#20");
        qlDictMap.put("qxyj","50~20~20#20");

        qlDictMap1.put("qxsf","20~25~30#0");
        qlDictMap2.put("szdl","20~20~30#20#10#5");
        qlDictMap3.put("zbsg","20~20~5#10#20");
        qlDictMap4.put("yxnd","20~15~20#5#20");
        qlDictMap5.put("jlzh","20~20~5#10#20");
        qlDictMap6.put("qmcd","30~50~10#20");
        qlDictMap7.put("qlsz","30~50~30#20#10#5");
        qlDictMap8.put("sfaz","50~20~30#0");
        qlDictMap9.put("dqjc","50~30~0#30");
        qlDictMap10.put("bjcz","50~30~10#20");
        qlDictMap11.put("qxyj","50~20~20#20");
        /*--------------------桥梁模型end------------------*/

        /*--------------------建筑消防模型start------------------*/
        jzxfDictMap.put("jzns","20~30~30#10");
        jzxfDictMap.put("jzwn","20~30~30#10");
        jzxfDictMap.put("hzyl","20~20~20#5");
        jzxfDictMap.put("lcsl","30~30~5#20#30");
        jzxfDictMap.put("jzwnc","30~30~5#10#20");
        jzxfDictMap.put("jzws","30~20~10#20#20#10#20");
        jzxfDictMap.put("sfjx","50~30~30#0");
        jzxfDictMap.put("dqsf","50~30~0#30");
        jzxfDictMap.put("bjsf","50~40~20#30");

        jzxfDictMap1.put("jzns","20~30~30#10");
        jzxfDictMap2.put("jzwn","20~30~30#10");
        jzxfDictMap3.put("hzyl","20~20~20#5");
        jzxfDictMap4.put("lcsl","30~30~5#20#30");
        jzxfDictMap5.put("jzwnc","30~30~5#10#20");
        jzxfDictMap6.put("jzws","30~20~10#20#20#10#20");
        jzxfDictMap7.put("sfjx","50~30~30#0");
        jzxfDictMap8.put("dqsf","50~30~0#30");
        jzxfDictMap9.put("bjsf","50~40~20#30");
        /*--------------------建筑消防模型end------------------*/

        /*--------------------交通模型start------------------*/
        jtDictMap.put("cllx","50~10~10#5#3#0");
        jtDictMap.put("yshx","50~20~30#20#10");
        jtDictMap.put("whps","50~30~30#20#10");
        jtDictMap.put("szlw","50~10~5#10");
        jtDictMap.put("clsz","50~30~30#20#0");
        jtDictMap.put("sfaz","50~20~30#10");
        jtDictMap.put("jksf","50~30~0#20");
        jtDictMap.put("bjcz","50~30~10#20");
        jtDictMap.put("qxzk","50~20~10#10#10#10#0");

        jtDictMap1.put("cllx","50~10~10#5#3#0");
        jtDictMap2.put("yshx","50~20~30#20#10");
        jtDictMap3.put("whps","50~30~30#20#10");
        jtDictMap4.put("szlw","50~10~5#10");
        jtDictMap5.put("clsz","50~30~30#20#0");
        jtDictMap6.put("sfaz","50~20~30#10");
        jtDictMap7.put("jksf","50~30~0#20");
        jtDictMap8.put("bjcz","50~30~10#20");
        jtDictMap9.put("qxzk","50~20~10#10#10#10#0");
        /*--------------------交通模型end------------------*/

        /*--------------------场站风险评估模型start------------------*/
        stationDictMap.put("bjq","1.0~0.215~0#100");//是否安装燃气监测报警器
        stationDictMap.put("yjya","1.0~0.05~0#100");//是否编制应急预案
        stationDictMap.put("yjyl","1.0~0.38~0#50#100");//是否开展应急演练
        stationDictMap.put("yhsb","1.0~0.215~0#50#100");//是否开展隐患排查并上报
        stationDictMap.put("aqcf3y","1.0~0.14~100#0");//近3年是否接受过安全处罚
        //stationDictMap.put("jzw150m","0.50~1.0~0#100");//周边150米范围内是否有建筑物

        stationDictMap1.put("bjq","1.0~0.215~0#100");//是否安装燃气监测报警器
        stationDictMap2.put("yjya","1.0~0.05~0#100");//是否编制应急预案
        stationDictMap3.put("yjyl","1.0~0.38~0#50#100");//是否开展应急演练
        stationDictMap4.put("yhsb","1.0~0.215~0#50#100");//是否开展隐患排查并上报
        stationDictMap5.put("aqcf3y","1.0~0.14~100#0");//近3年是否接受过安全处罚

        /*--------------------场站风险评估模型end------------------*/

        /*--------------------场站风险评估模型start------------------*/
        stationComprehensiveDictMap.put("bjq","0.50~0.215~0#100");//是否安装燃气监测报警器
        stationComprehensiveDictMap.put("yjya","0.50~0.05~0#100");//是否编制应急预案
        stationComprehensiveDictMap.put("yjyl","0.50~0.38~0#50#100");//是否开展应急演练
        stationComprehensiveDictMap.put("yhsb","0.50~0.215~0#50#100");//是否开展隐患排查并上报
        stationComprehensiveDictMap.put("aqcf3y","0.50~0.14~100#0");//近3年是否接受过安全处罚
        stationComprehensiveDictMap.put("jzw150m","0.50~1.0~0#100");//周边150米范围内是否有建筑物

        stationComprehensiveDictMap1.put("bjq","0.50~0.215~0#100");//是否安装燃气监测报警器
        stationComprehensiveDictMap2.put("yjya","0.50~0.05~0#100");//是否编制应急预案
        stationComprehensiveDictMap3.put("yjyl","0.50~0.38~0#50#100");//是否开展应急演练
        stationComprehensiveDictMap4.put("yhsb","0.50~0.215~0#50#100");//是否开展隐患排查并上报
        stationComprehensiveDictMap5.put("aqcf3y","0.50~0.14~100#0");//近3年是否接受过安全处罚
        stationComprehensiveDictMap6.put("jzw150m","0.50~1.0~0#100");//周边150米范围内是否有建筑物

        /*--------------------场站风险评估模型end------------------*/

        /*--------------------场站综合风险评估模型start------------------*/
        enterpriseComprehensiveDictMap.put("fgl","1.0~0.20~20#10#3");//风险监测的覆盖率
        enterpriseComprehensiveDictMap.put("zxl","1.0~0.20~20#10#2");//监测设备在线率
        enterpriseComprehensiveDictMap.put("bjl","1.0~0.10~10#0");//监测报警率
        enterpriseComprehensiveDictMap.put("jsl","1.0~0.20~20#10#0");//报警处置及时率
        enterpriseComprehensiveDictMap.put("aqscsg","1.0~0.30~0#10#30");//安全生产事故
        enterpriseComprehensiveDictMap.put("jzw150m","0.50~1.0~0#100");//周边150米范围内是否有建筑物

        enterpriseComprehensiveDictMap1.put("fgl","1.0~0.20~20#10#3");//风险监测的覆盖率
        enterpriseComprehensiveDictMap2.put("zxl","1.0~0.20~20#10#2");//监测设备在线率
        enterpriseComprehensiveDictMap3.put("bjl","1.0~0.10~10#0");//监测报警率
        enterpriseComprehensiveDictMap4.put("jsl","1.0~0.20~20#10#0");//报警处置及时率
        enterpriseComprehensiveDictMap5.put("aqscsg","1.0~0.30~0#10#30");//安全生产事故

        /*--------------------场站综合风险评估模型end------------------*/
    }


    @ApiOperation("DT-电梯")
    @PostMapping("/dt")
    public Map dt(@RequestBody DtDto dtDto) {
        Map map = new HashMap();
        Map map1 = new HashMap();

        map.put("number",dtDto.getNumber());

        Double score = calculateScore(dtDto,dtDictMap,"DT");
        map.put("score",score);
        map.put("name",this.riskLevelDT(score));

        Double score1 = calculateScore(dtDto,dtDictMap1,"DT");
        map1.put("运行年代",score1);
        score1 = calculateScore(dtDto,dtDictMap2,"DT");
        map1.put("电梯近3年发生故障数量",score1);

        score1 = calculateScore(dtDto,dtDictMap3,"DT");
        map1.put("所在建筑物类型",score1);

        score1 = calculateScore(dtDto,dtDictMap4,"DT");
        map1.put("建筑物层高",score1);

        score1 = calculateScore(dtDto,dtDictMap5,"DT");
        map1.put("电梯类型",score1);

        score1 = calculateScore(dtDto,dtDictMap6,"DT");
        map1.put("是否安装在线监测系统",score1);

        //score1 = calculateScore(dtDto,dtDictMap7,"DT");
        //map1.put("距离上一次维保时间",score1);

        score1 = calculateScore(dtDto,dtDictMap8,"DT");
        map1.put("是否报警",score1);

        score1 = calculateScore(dtDto,dtDictMap9,"DT");
        map1.put("是否困人",score1);

        score1 = calculateScore(dtDto,dtDictMap10,"DT");
        map1.put("报警处置情况",score1);

        map.put("details",map1);
        map.put("input",dtDto);

        return map;
    }



    @ApiOperation("RQGW-燃气管网")
    @PostMapping("/rqgw")
    public Map rqgw(@RequestBody RqgwDto rqgwDto){
        Map map = new HashMap();
        Map map1 = new HashMap();

        map.put("number",rqgwDto.getNumber());

        if(rqgwDto.getGwjb_gl()!=null&&rqgwDto.getGwjb_gl()!="")
        {
            Double gl = Double.parseDouble(rqgwDto.getGwjb_gl());
            if(gl<5){
                rqgwDto.setGwjb_gl("1");
            }else if(gl<15){
                rqgwDto.setGwjb_gl("2");
            }else{
                rqgwDto.setGwjb_gl("3");
            }
        }
        if(rqgwDto.getGwjb_ms()!=null && rqgwDto.getGwjb_ms()!="")
        {
            Double ms = Double.parseDouble(rqgwDto.getGwjb_ms());
            if(ms<0.8){
                rqgwDto.setGwjb_ms("1");
            }else if(ms<1.5){
                rqgwDto.setGwjb_ms("2");
            }else{
                rqgwDto.setGwjb_ms("3");
            }
        }

        Double score = calculateScore(rqgwDto,rqgwDictMap,"RQ");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(rqgwDto,rqgwDictMap1,"RQ");
        map1.put("管龄",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap2,"RQ");
        map1.put("管材",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap3,"RQ");
        map1.put("埋深",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap4,"RQ");
        map1.put("管道上是否有附属设施",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap5,"RQ");
        map1.put("金属材质管道的防腐层是否被破坏",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap6,"RQ");
        map1.put("管道周边100米范围内有无地质灾害隐患点",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap7,"RQ");
        map1.put("管道所在地区域类型",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap8,"RQ");
        map1.put("管道上方用地类型",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap9,"RQ");
        map1.put("管道防护措施",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap10,"RQ");
        map1.put("周边5米范围内有无密闭空间",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap11,"RQ");
        map1.put("压力等级",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap12,"RQ");
        map1.put("周边500米范围内危险源、防护目标数量R",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap13,"RQ");
        map1.put("所在路网类型",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap14,"RQ");
        map1.put("所在区域人口密度",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap15,"RQ");
        map1.put("所在区域经济密度",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap16,"RQ");
        map1.put("近3年的泄漏情况",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap17,"RQ");
        map1.put("泄漏后的维修情况",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap18,"RQ");
        map1.put("周边燃气监测仪报警情况",score1);

        score1 = calculateScore(rqgwDto,rqgwDictMap19,"RQ");
        map1.put("报警处置情况",score1);
        map.put("details",map1);
        map.put("input",rqgwDto);


        return map;
    }

    @ApiOperation("GSGW-供水管网")
    @PostMapping("/gsgw")
    public Map gsgw(@RequestBody GsgwDto gsgwDto) {
        Map map = new HashMap();
        Map map1 = new HashMap();
        map.put("number",gsgwDto.getNumber());

        if(gsgwDto.getGj() !=null)
        {
            Double gj = Double.parseDouble(gsgwDto.getGj());
            if(gj<200){
                gsgwDto.setGj("1");
            }else if(gj<600){
                gsgwDto.setGj("2");
            }else{
                gsgwDto.setGj("3");
            }
        }

        Double score = calculateScore(gsgwDto,gsgwDictMap,"GS");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(gsgwDto,gsgwDictMap1,"GS");
        map1.put("管龄",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap2,"GS");
        map1.put("管材",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap3,"GS");
        map1.put("埋深",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap4,"GS");
        map1.put("管道上是否有附属设施",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap5,"GS");
        map1.put("金属材质管道的防腐层是否被破坏",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap6,"GS");
        map1.put("管道周边100米范围内有无地质灾害隐患点",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap7,"GS");
        map1.put("管道所在地区域类型",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap8,"GS");
        map1.put("管道上方用地类型",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap9,"GS");
        map1.put("管道防护措施",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap10,"GS");
        map1.put("所在路网类型",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap11,"GS");
        map1.put("所在区域人口密度",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap12,"GS");
        map1.put("所在区域经济密度",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap13,"GS");
        map1.put("管径",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap14,"GS");
        map1.put("季节",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap15,"GS");
        map1.put("周边3公里范围内大用水用户数量",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap16,"GS");
        map1.put("近3年的泄漏情况",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap17,"GS");
        map1.put("泄漏后的维修情况",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap18,"GS");
        map1.put("周边压力流量漏失监测仪报警情况",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap19,"GS");
        map1.put("管道上漏失声波报警情况",score1);

        score1 = calculateScore(gsgwDto,gsgwDictMap20,"GS");
        map1.put("报警处置情况",score1);
        map.put("details",map1);
        map.put("input",gsgwDto);

        return map;
    }


    @ApiOperation("PSGW-排水管网")
    @PostMapping("/psgw")
    public Map psgw(@RequestBody PsgwDto psgwDto) {
        Map map = new HashMap();
        Map map1 = new HashMap();
        map.put("number",psgwDto.getNumber());

        Double score = calculateScore(psgwDto,psgwDictMap,"PS");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(psgwDto,psgwDictMap1,"PS");
        map1.put("地形",score1);

        score1 = calculateScore(psgwDto,psgwDictMap2,"PS");
        map1.put("地面高程",score1);

        score1 = calculateScore(psgwDto,psgwDictMap3,"PS");
        map1.put("地面坡度",score1);

        score1 = calculateScore(psgwDto,psgwDictMap4,"PS");
        map1.put("地面参透性",score1);

        score1 = calculateScore(psgwDto,psgwDictMap5,"PS");
        map1.put("水系",score1);

        score1 = calculateScore(psgwDto,psgwDictMap6,"PS");
        map1.put("排水管网",score1);

        score1 = calculateScore(psgwDto,psgwDictMap7,"PS");
        map1.put("人口密集",score1);

        score1 = calculateScore(psgwDto,psgwDictMap8,"PS");
        map1.put("经济密度",score1);

        score1 = calculateScore(psgwDto,psgwDictMap9,"PS");
        map1.put("应急能力",score1);

        score1 = calculateScore(psgwDto,psgwDictMap10,"PS");
        map1.put("防灾能力",score1);

        score1 = calculateScore(psgwDto,psgwDictMap11,"PS");
        map1.put("救护能力",score1);
        map.put("details",map1);
        map.put("input",psgwDto);

        return map;
    }

    @ApiOperation("RLGW-热力管网")
    @PostMapping("/rlgw")
    public Map rlgw(@RequestBody RlgwDto rlgwDto) {
        Map map = new HashMap();
        Map map1 = new HashMap();
        map.put("number",rlgwDto.getNumber());

        if(rlgwDto.getGwjb_ms()!=null) {
            Double ms = Double.parseDouble(rlgwDto.getGwjb_ms());

            if (ms < 0.8) {
                rlgwDto.setGwjb_ms("1");
            } else if (ms < 1.5) {
                rlgwDto.setGwjb_ms("2");
            } else {
                rlgwDto.setGwjb_ms("3");
            }
        }
        if(rlgwDto.getGj()!=null) {
            Double gj = Double.parseDouble(rlgwDto.getGj());
            if (gj < 200) {
                rlgwDto.setGj("1");
            } else if (gj < 600) {
                rlgwDto.setGj("2");
            } else {
                rlgwDto.setGj("3");
            }
        }

        Double score = calculateScore(rlgwDto,rlgwDictMap,"RL");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(rlgwDto,rlgwDictMap1,"RL");
        map1.put("管龄",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap2,"RL");
        map1.put("埋深",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap3,"RL");
        map1.put("管道上是否有附属设施",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap4,"RL");
        map1.put("金属材质管道的防腐层是否被破坏",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap5,"RL");
        map1.put("管道周边100米范围内有无地质灾害隐患点",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap6,"RL");
        map1.put("管道所在地区域类型",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap7,"RL");
        map1.put("管道上方用地类型",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap8,"RL");
        map1.put("管道防护措施",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap9,"RL");
        map1.put("所在路网类型",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap10,"RL");
        map1.put("所在区域人口密度",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap11,"RL");
        map1.put("所在区域经济密度",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap12,"RL");
        map1.put("管径",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap13,"RL");
        map1.put("压力等级",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap14,"RL");
        map1.put("季节",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap15,"RL");
        map1.put("周边100米范围内危险源、防护目标数量R",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap16,"RL");
        map1.put("周边3公里范围内的小区或商业综合体数量",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap17,"RL");
        map1.put("近3年的泄漏情况",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap18,"RL");
        map1.put("泄漏后的维修情况",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap19,"RL");
        map1.put("周边压力流量漏失监测仪或人工巡检、舆情报警情况",score1);

        score1 = calculateScore(rlgwDto,rlgwDictMap20,"RL");
        map1.put("报警处置情况",score1);
        map.put("details",map1);
        map.put("input",rlgwDto);

        return map;
    }

    @ApiOperation("QL-桥梁")
    @PostMapping("/ql")
    public Map ql(@RequestBody QlDto qlDto){
        Map map = new HashMap();
        Map map1 = new HashMap();
        map.put("number",qlDto.getNumber());

        Double score = calculateScore(qlDto,qlDictMap,"QL");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(qlDto,qlDictMap1,"QL");
        map1.put("桥下是否能通航",score1);

        score1 = calculateScore(qlDto,qlDictMap2,"QL");
        map1.put("所在道路类型",score1);

        score1 = calculateScore(qlDto,qlDictMap3,"QL");
        map1.put("周边10公里范围物流园数量",score1);

        score1 = calculateScore(qlDto,qlDictMap4,"QL");
        map1.put("运行年代Y1",score1);

        score1 = calculateScore(qlDto,qlDictMap5,"QL");
        map1.put("距离最后一次检修周期Y2",score1);

        score1 = calculateScore(qlDto,qlDictMap6,"QL");
        map1.put("桥面车道数量",score1);

        score1 = calculateScore(qlDto,qlDictMap7,"QL");
        map1.put("桥梁所在道路类型",score1);

        score1 = calculateScore(qlDto,qlDictMap8,"QL");
        map1.put("是否安装在线监测系统",score1);

        score1 = calculateScore(qlDto,qlDictMap9,"QL");
        map1.put("当前监测是否报警",score1);

        score1 = calculateScore(qlDto,qlDictMap10,"QL");
        map1.put("报警处置情况",score1);

        score1 = calculateScore(qlDto,qlDictMap11,"QL");
        map1.put("气象预警信息",score1);
        map.put("details",map1);
        map.put("input",qlDto);
        return map;
    }

    @ApiOperation("JZXF-建筑消防")
    @PostMapping("/jzxf")
    public Map jzxf(@RequestBody JzxfDto jzxfDto) {
        Map map = new HashMap();
        map.put("input",jzxfDto);

        Map map1 = new HashMap();
        map.put("number",jzxfDto.getNumber());

        if (jzxfDto.getLcsl() != null) {
            Double lcsl = Double.parseDouble(jzxfDto.getLcsl());
            if (lcsl < 0.8) {
                jzxfDto.setLcsl("1");
            } else if (lcsl < 1.5) {
                jzxfDto.setLcsl("2");
            } else {
                jzxfDto.setLcsl("3");
            }
        }
        if (jzxfDto.getJzwnc() != null) {
            Double jzwnc = Double.parseDouble(jzxfDto.getJzwnc());
            if (jzwnc < 0.6) {
                jzxfDto.setJzwnc("3");
            } else if (jzwnc < 1) {
                jzxfDto.setJzwnc("2");
            } else {
                jzxfDto.setJzwnc("1");
            }
        }

        Double score = calculateScore(jzxfDto,jzxfDictMap,"XF");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(jzxfDto,jzxfDictMap1,"XF");
        map1.put("建筑内是否涉易燃易爆物经营",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap2,"XF");
        map1.put("建筑物内是否涉及大功率电器或用电设备",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap3,"XF");
        map1.put("火灾演练周期",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap4,"XF");
        map1.put("楼层数量",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap5,"XF");
        map1.put("建筑物内从业人员密度ρ（平方米/人）",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap6,"XF");
        map1.put("建筑物所在区域类型",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap7,"XF");
        map1.put("是否进行智慧消防系统建设",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap8,"XF");
        map1.put("当前是否有报警",score1);

        score1 = calculateScore(jzxfDto,jzxfDictMap9,"XF");
        map1.put("报警是否处置",score1);
        map.put("details",map1);

        return map;
    }

    @ApiOperation("JT-交通")
    @PostMapping("/jt")
    public Map jt(@RequestBody JtDto jtDto) {
        Map map = new HashMap();
        map.put("input",jtDto);

        Map map1 = new HashMap();
        map.put("number",jtDto.getNumber());
        Double score = calculateScore(jtDto,jtDictMap,"JT");
        map.put("score",score);
        map.put("name",this.riskLevel(score));

        Double score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("车辆类型",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("运输化学品类型",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("危化品数量",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("所在路网类型",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("车辆所在位置道路两边环境",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("是否安装在线监控系统",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("监控是否报警",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("报警处置状态",score1);
        score1 = calculateScore(jtDto,jtDictMap,"JT");
        map1.put("气象状况",score1);
        map.put("details",map1);

        return map;
    }

    @ApiOperation("QYHYFX-区域的行业风险值")
    @PostMapping("/qyhyfx")
    public Map jt(@RequestBody QyhyfxDto qyhyfxDto) {
        Map map = new HashMap();
        map.put("input",qyhyfxDto);

        Map map1 = new HashMap();
        map.put("number",qyhyfxDto.getNumber());

        Double score = 0.0;
        if(qyhyfxDto.getTotal()!=null
                && qyhyfxDto.getZdfxNum()!=null
                && qyhyfxDto.getJdfxNum()!=null
                && qyhyfxDto.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            score = (qyhyfxDto.getZdfxNum()+0.3*qyhyfxDto.getJdfxNum()+0.1*qyhyfxDto.getYbfxNum())/qyhyfxDto.getTotal()*100.0;
            score = score+30.0;
        }

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        map1.put("一级风险",Constant.DoubleFormat2(1.0*qyhyfxDto.getZdfxNum()/qyhyfxDto.getTotal()*100.0));
        map1.put("二级风险",Constant.DoubleFormat2(0.3*qyhyfxDto.getJdfxNum()/qyhyfxDto.getTotal()*100.0));
        map1.put("三级风险",Constant.DoubleFormat2(0.1*qyhyfxDto.getYbfxNum()/qyhyfxDto.getTotal()*100.0));
        map.put("details",map1);

        return map;
    }


    public Map calcA(QyhyfxDto qyhyfxDto){
        Map map1 = new HashMap();
        if(qyhyfxDto.getZdfxNum() !=null && qyhyfxDto.getTotal()!= null)
        {
            map1.put("一级风险得分",Constant.DoubleFormat2(1.0*qyhyfxDto.getZdfxNum()/qyhyfxDto.getTotal()*100.0));
            map1.put("一级风险个数",qyhyfxDto.getZdfxNum());
        }

        if(qyhyfxDto.getJdfxNum() !=null && qyhyfxDto.getTotal()!= null)
        {
            map1.put("二级风险得分",Constant.DoubleFormat2(0.3*qyhyfxDto.getJdfxNum()/qyhyfxDto.getTotal()*100.0));
            map1.put("二级风险个数",qyhyfxDto.getJdfxNum());
        }

        if(qyhyfxDto.getYbfxNum() !=null && qyhyfxDto.getTotal()!= null)
        {
            map1.put("三级风险得分",Constant.DoubleFormat2(0.1*qyhyfxDto.getYbfxNum()/qyhyfxDto.getTotal()*100.0));
            map1.put("三级风险个数",qyhyfxDto.getYbfxNum());
        }

        return map1;
    }

    @ApiOperation("JTAQ-交通安全")
    @PostMapping("/jtaq")
    public Map jt(@RequestBody JtaqDto jtaqDto) {
        Map map = new HashMap();
        map.put("input",jtaqDto);

        Map map1 = new HashMap();
        map.put("number",jtaqDto.getNumber());
        Double score = 0.0;
        Double tmp = 0.0;
        //过去一年报警次数
        if(jtaqDto.getBjcs()!=null)
        {
           if(jtaqDto.getBjcs() >= 10)
           {
               score = score +  30.0;
           }
           else if(jtaqDto.getBjcs() >= 5)
           {
               score = score +  20.0;
           }
           else if(jtaqDto.getBjcs() >= 3)
           {
               score = score +  10.0;
           }
        }
         map1.put("过去一年报警次数",score - tmp);
        tmp = score;

        //车道偏离--1:否;2:是
        if(jtaqDto.getCdpl()!=null)
        {
            if(jtaqDto.getCdpl() == 2)
            {
                score = score +  20.0;
            }
        }

        map1.put("车道偏离",score - tmp);
        tmp = score;

        //驾驶员是否异常--1:否;2:是
        if(jtaqDto.getJsyyc()!=null)
        {
            if(jtaqDto.getJsyyc() == 2)
            {
                score = score +  20.0;
            }
        }
        map1.put("驾驶员是否异常",score - tmp);
        tmp = score;

        //车距是否过近--1:否;2:是
        if(jtaqDto.getCjgj()!=null)
        {
            if(jtaqDto.getCjgj() == 2)
            {
                score = score +  10.0;
            }
        }
        map1.put("车距是否过近",score - tmp);
        tmp = score;

        //驾驶员是否疲劳驾驶--1:否;2:是
        if(jtaqDto.getPljs()!=null)
        {
            if(jtaqDto.getPljs() == 2)
            {
                score = score +  20.0;
            }
        }
        map1.put("驾驶员是否疲劳驾驶",score - tmp);
        tmp = score;

        //驾驶员是否注意力分散--1:否;2:是
        if(jtaqDto.getZylfs()!=null)
        {
            if(jtaqDto.getZylfs() == 2)
            {
                score = score +  10.0;
            }
        }
        map1.put("驾驶员是否注意力分散",score - tmp);
        tmp = score;


        //向前碰撞--1:否;2:是
        if(jtaqDto.getXqpz()!=null)
        {
            if(jtaqDto.getXqpz() == 2)
            {
                score = score +  20.0;
            }
        }
        map1.put("向前碰撞",score - tmp);
        tmp = score;

        //行人碰撞--1:否;2:是
        if(jtaqDto.getXrpz()!=null)
        {
            if(jtaqDto.getXrpz() == 2)
            {
                score = score +  10.0;
            }
        }
        map1.put("行人碰撞",score - tmp);
        tmp = score;

        map.put("score",score);
        map.put("name",this.riskLevel(score));
        map.put("details",map1);

        return map;
    }

    private Double calculateScore(Object obj,Map<String,String> dictMap,String category){
        Risk where = new Risk();
        where.setCategory(category);
        where.setLevel(2l);
        List<Risk> riskList = riskService.selectRiskList(where);
        for(Risk risk:riskList){
            Risk riskP = riskService.selectRiskById(risk.getParentId());
            Double weight = risk.getWeight();
            String code = risk.getCode();
            Double weightP = riskP.getWeight();
            String dict = dictMap.get(code);
            if(dict!=null&&dict.length()>0){
                dictMap.put(code,weightP.toString() + "~" + weight.toString() + "~" + dict.split("~")[2]);
            }

        }
        return calculateScore(obj,dictMap);
    }

    private Double calculateScore(Object obj,Map<String,String> dictMap){
        Class<?> clazz = obj.getClass();
        Field[] fields = clazz.getDeclaredFields();
        Double score = 0.0;
        for(Field field:fields){
            field.setAccessible(true);
            try {
                if(field.get(obj)==null){
                    continue;
                }
                String fieldName = field.getName();
                String fieldValue = field.get(obj).toString();
                //获取三级分数下标值，需要是整数，如1、2、3、4
                int index = Integer.parseInt(fieldValue);
                //获取字段对应字典数据
                String dictValue = dictMap.get(fieldName);
                //获取一二三级数据值
                String[] level = dictValue.split("~");
                //获取三级明细值
                String[] three = level[2].split("#");
                //统计三级明细总值
                Double threeCount = 0.0;
                for(String t:three){
//                    threeCount+=Double.parseDouble(t);
                    Double temp = Double.parseDouble(t);
                    int res =  temp.compareTo(threeCount);
                    if(res > 0) {
                        threeCount = temp;
                    }
                }
                //获取参数对应三级分数值
                String threeScore = three[index-1];
                //计算该字段对应分值：三级分数*二级占比*一级占比/100
                //计算该字段对应分值：三级分数/三級统计*二级占比*一级占比
                score += Constant.DoubleFormat((100*Double.parseDouble(threeScore)/threeCount*Double.parseDouble(level[1])*Double.parseDouble(level[0])));
                System.out.println("threeScore:"+threeScore+"---0:"+level[0]+"---1:"+level[1]+"---score:"+score);
            }catch (Exception e){

                e.printStackTrace();
            }
        }
        return score;
    }

    private String riskLevel(Double score){
        String level = "四级风险";
        if(score>=80){
            level = "一级风险";
        }else if(score>=50){
            level = "二级风险";
        }else if(score>=20){
            level = "三级风险";
        }else{
            level = "四级风险";
        }
        return level;
    }

    private String riskLevelST(Double score){
        String level = "低风险";
        if(score>=80){
            level = "高风险";
        }else if(score>=60){
            level = "较高风险";
        }else if(score>=30){
            level = "一般风险";
        }else{
            level = "低风险";
        }
        return level;
    }


    private String riskLevelGas(Double score){
        String level = "四级风险";
        if(score>=80){
            level = "一级风险";
        }else if(score>=60){
            level = "二级风险";
        }else if(score>=40){
            level = "三级风险";
        }else{
            level = "四级风险";
        }
        return level;
    }

    private String riskLevelDT(Double score){
        String level = "四级风险";
        if(score>=80){
            level = "一级风险";
        }else if(score>=50){
            level = "二级风险";
        }else if(score>=40){
            level = "三级风险";
        }else{
            level = "四级风险";
        }
        return level;
    }


    @ApiOperation("区域的行业风险值-电梯")
    @PostMapping("/area/risk/dt")
    public Map jt(@RequestBody AreaRiskDT areaRiskDT) {
        Map map = new HashMap();
        map.put("input",areaRiskDT);

        Map map1 = new HashMap();
        map.put("number",areaRiskDT.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskDT.getTotal()!=null
                && areaRiskDT.getZdfxNum()!=null
                && areaRiskDT.getJdfxNum()!=null
                && areaRiskDT.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskDT.getZdfxNum()+0.3*areaRiskDT.getJdfxNum()+0.1*areaRiskDT.getYbfxNum())/areaRiskDT.getTotal()*100.0;
            //score = score+30.0;
        }
        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskDT.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskDT.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskDT.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskDT.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));

        Double b = 0.0;
        if(areaRiskDT.getAccidentRate()!=null)
        {
            //1：大于0.01%；0：小于等于0.01%
            if(areaRiskDT.getAccidentRate()> 0.01)
            {
                b = b+40.0;
            }
            else
            {
                b = b+10.0;
            }
        }

        Double c = 0.0;
        if(areaRiskDT.getNoMaintainNum()!=null)
        {
            c = c+areaRiskDT.getNoMaintainNum()*2;
        }
        if(areaRiskDT.getNoHandleNum()!=null)
        {
            c = c+areaRiskDT.getNoHandleNum()*5;
        }

        if(c>40.0)
        {
           c = 40.0;
        }
        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("风险数量",Constant.DoubleFormat2(a));
        map1.put("B 电梯事故发生率",Constant.DoubleFormat2(b));
        map1.put("C 未维保未及时处置",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }


    @ApiOperation("区域的行业风险值-供水")
    @PostMapping("/area/risk/gs")
    public Map jt(@RequestBody AreaRiskGS areaRiskGS) {
        Map map = new HashMap();
        map.put("input",areaRiskGS);

        Map map1 = new HashMap();
        map.put("number",areaRiskGS.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskGS.getTotal()!=null
                && areaRiskGS.getZdfxNum()!=null
                && areaRiskGS.getJdfxNum()!=null
                && areaRiskGS.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskGS.getZdfxNum()+0.3*areaRiskGS.getJdfxNum()+0.1*areaRiskGS.getYbfxNum())/areaRiskGS.getTotal()*100.0;
            //score = score+30.0;
        }

        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskGS.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskGS.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskGS.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskGS.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));

        Double b = 0.0;
        if(areaRiskGS.getWaterConsumption()!=null&&areaRiskGS.getAverageConsumption()!=null)
        {
            if(areaRiskGS.getWaterConsumption()/areaRiskGS.getAverageConsumption()>1.1)
            {
                b = b+20.0;
            }
            else if(areaRiskGS.getWaterConsumption()/areaRiskGS.getAverageConsumption()<0.9)
            {
                b = b+5.0;
            }
            else {
                b = b+10.0;
            }

        }
        else {
            b = b+10.0;
        }

        Double c = 0.0;
        if(areaRiskGS.getLeakageRate()!=null&&areaRiskGS.getLeakageRate()==1)
        {
            c = c+20.0;
        }
        else
        {
            c = c+5.0;
        }
        if(areaRiskGS.getLeakageNum()!=null)
        {
            c = c+areaRiskGS.getLeakageNum()*2;
        }

        if(c>40.0)
        {
            c = 40.0;
        }
        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("用水量",Constant.DoubleFormat2(a));
        map1.put("B 用水量",Constant.DoubleFormat2(b));
        map1.put("C 漏水事件及漏损率事故",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }


    @ApiOperation("区域的行业风险值-交通")
    @PostMapping("/area/risk/jt")
    public Map jt(@RequestBody AreaRiskJT areaRiskJT) {
        Map map = new HashMap();
        map.put("input",areaRiskJT);

        Map map1 = new HashMap();
        map.put("number",areaRiskJT.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskJT.getTotal()!=null
                && areaRiskJT.getZdfxNum()!=null
                && areaRiskJT.getJdfxNum()!=null
                && areaRiskJT.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskJT.getZdfxNum()+0.3*areaRiskJT.getJdfxNum()+0.1*areaRiskJT.getYbfxNum())/areaRiskJT.getTotal()*100.0;
            //score = score+30.0;
        }

        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskJT.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskJT.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskJT.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskJT.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));


        Double b = 0.0;
        if(areaRiskJT.getDensity()!=null&&areaRiskJT.getDensity()==1)
        {
            b = b+20.0;
        }
        else {
            b = b+5.0;
        }

        Double c = 0.0;
        if(areaRiskJT.getAccidentNum()!=null)
        {
            c = c + areaRiskJT.getAccidentNum() * 5;
        }

        if(c>40.0)
        {
            c = 40.0;
        }
        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("风险数量",Constant.DoubleFormat2(a));
        map1.put("B 危化品运输道路密度",Constant.DoubleFormat2(b));
        map1.put("C 发生危化品运输车辆事故的次数",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }

    @ApiOperation("区域的行业风险值-排水")
    @PostMapping("/area/risk/ps")
    public Map jt(@RequestBody AreaRiskPS areaRiskPS) {
        Map map = new HashMap();
        map.put("input",areaRiskPS);

        Map map1 = new HashMap();
        map.put("number",areaRiskPS.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskPS.getDensity()!=null&&areaRiskPS.getDensity()==1)
        {
            a = a + 40;
        }
        else
        {
            a = a + 10;
        }

        Double b = 0.0;
        if(areaRiskPS.getPsDensity()!=null&&areaRiskPS.getPsDensity()==1)
        {
            b = b+40.0;
        }
        else {
            b = b+10.0;
        }

        Double c = 0.0;
        if(areaRiskPS.getFiveYearwaterloggingNum()!=null)
        {
            c = c + areaRiskPS.getFiveYearwaterloggingNum() * 5;
        }

        if(c>40.0)
        {
            c = 40.0;
        }
        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        map1.put("A 区域内涝点密度",Constant.DoubleFormat2(a));
        map1.put("B 区域排水管网密度",Constant.DoubleFormat2(b));
        map1.put("C 区域内涝次数",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }


    @ApiOperation("区域的行业风险值-桥梁")
    @PostMapping("/area/risk/ql")
    public Map jt(@RequestBody AreaRiskQL areaRiskQL) {
        Map map = new HashMap();
        map.put("input",areaRiskQL);

        Map map1 = new HashMap();
        map.put("number",areaRiskQL.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskQL.getTotal()!=null
                && areaRiskQL.getZdfxNum()!=null
                && areaRiskQL.getJdfxNum()!=null
                && areaRiskQL.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskQL.getZdfxNum()+0.3*areaRiskQL.getJdfxNum()+0.1*areaRiskQL.getYbfxNum())/areaRiskQL.getTotal()*100.0;
            //score = score+30.0;
        }

        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskQL.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskQL.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskQL.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskQL.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));

        Double c = 0.0;
        if(areaRiskQL.getDensity()!=null&&areaRiskQL.getDensity()==1)
        {
            c = c+30.0;
        }
        else {
            c = c+5.0;
        }

        Double b = 0.0;
        if(areaRiskQL.getMonitorNum()!=null&&areaRiskQL.getTotalNum()!=null)
        {
            b =  (areaRiskQL.getTotalNum()-areaRiskQL.getMonitorNum()) * 5.0/areaRiskQL.getTotalNum();
        }
        else
        {
            b = 5.0;
        }
        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("风险数量",Constant.DoubleFormat2(a));
        map1.put("B 桥梁的监测覆盖率",Constant.DoubleFormat2(b));
        map1.put("C 物流园密度",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }



    @ApiOperation("区域的行业风险值-燃气")
    @PostMapping("/area/risk/rq")
    public Map jt(@RequestBody AreaRiskRQ areaRiskRQ) {
        Map map = new HashMap();
        map.put("input",areaRiskRQ);

        Map map1 = new HashMap();
        map.put("number",areaRiskRQ.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskRQ.getTotal()!=null
                && areaRiskRQ.getZdfxNum()!=null
                && areaRiskRQ.getJdfxNum()!=null
                && areaRiskRQ.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskRQ.getZdfxNum()+0.3*areaRiskRQ.getJdfxNum()+0.1*areaRiskRQ.getYbfxNum())/areaRiskRQ.getTotal()*100.0;
            //score = score+30.0;
        }

        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskRQ.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskRQ.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskRQ.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskRQ.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));

        Double b = 0.0;
        if(areaRiskRQ.getLeakageNum()!=null&&areaRiskRQ.getLeakageNum()==1)
        {
            b = b+30.0;
        }
        else {
            b = b+5.0;
        }

        Double c = 0.0;
        if(areaRiskRQ.getDensity()!=null&&areaRiskRQ.getDensity()==1)
        {
            c = 20.0;
        }
        else
        {
            c = 5.0;
        }

        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("风险数量",Constant.DoubleFormat2(a));
        map1.put("B 泄漏数据",Constant.DoubleFormat2(b));
        map1.put("C 燃气管道密度",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }


    @ApiOperation("区域的行业风险值-热力")
    @PostMapping("/area/risk/rl")
    public Map jt(@RequestBody AreaRiskRL areaRiskRL) {
        Map map = new HashMap();
        map.put("input",areaRiskRL);

        Map map1 = new HashMap();
        map.put("number",areaRiskRL.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskRL.getTotal()!=null
                && areaRiskRL.getZdfxNum()!=null
                && areaRiskRL.getJdfxNum()!=null
                && areaRiskRL.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskRL.getZdfxNum()+0.3*areaRiskRL.getJdfxNum()+0.1*areaRiskRL.getYbfxNum())/areaRiskRL.getTotal()*100.0;
            //score = score+30.0;
        }
        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskRL.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskRL.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskRL.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskRL.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));

        Double b = 0.0;
        if(areaRiskRL.getTemperature()!=null&&areaRiskRL.getTemperature()==1)
        {
            b = b+5.0;
        }
        else {
            b = b+30.0;
        }

        Double c = 0.0;
        if(areaRiskRL.getLeakageNum()!=null)
        {
            c = areaRiskRL.getLeakageNum()*2.0;
        }
        else
        {
            c = 5.0;
        }

        score = a + b + c;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("风险数量",Constant.DoubleFormat2(a));
        map1.put("B 气象温度",Constant.DoubleFormat2(b));
        map1.put("C 泄露爆炸",Constant.DoubleFormat2(c));
        map.put("details",map1);

        return map;
    }

    @ApiOperation("燃气监测点位风险评估模型")
    @PostMapping("/gas/point")
    public Map jt(@RequestBody GasPoint gasPoint) {
        Map map = new HashMap();
        map.put("input",gasPoint);

        map.put("number",gasPoint.getNumber());

        if(gasPoint.getPointNum()!=null){
            if(gasPoint.getPointNum()<=1){
                map.put("level","四级风险");
            }
            else if(gasPoint.getPointNum()<=3){
                map.put("level","三级风险");
            }
            else if(gasPoint.getPointNum()<=5){
                map.put("level","二级风险");
            }
            else {
                map.put("level","一级风险");
            }
        }
        else {
            map.put("msg","请输入以该点为圆心查询半径100米范围内公共场所的数量");
        }

        return map;
    }


    //add by czdu on 2023-08-10
    @ApiOperation("燃气监测点位风险评估模型")
    @PostMapping("/gasPointRisk")
    public Map gasPointRisk(@RequestBody DevRiskDto devRiskDto) {
        Map map = new HashMap();
        map.put("input",devRiskDto);

        Double score = 0.0 ;
        Integer m = 1 ;
        map.put("number",devRiskDto.getNumber());

        if(devRiskDto.getType()!=null&&devRiskDto.getNum100()!=null){
            if(devRiskDto.getType()==0){
                if(devRiskDto.getNum100()<=1)
                {
                    score = score + 5;
                }
                else if (devRiskDto.getNum100()<=3)
                {
                    score = score + 10;
                }
                else if (devRiskDto.getNum100()<=5)
                {
                    score = score + 20;
                }
                else if (devRiskDto.getNum100()>5)
                {
                    score = score + 30;
                }
            }
            else if(devRiskDto.getType()==1 || devRiskDto.getType()==2 ){
                if(devRiskDto.getNum100()<=1)
                {
                    score = score + 10;
                }
                else if (devRiskDto.getNum100()<=3)
                {
                    score = score + 20;
                }
                else if (devRiskDto.getNum100()<=5)
                {
                    score = score + 30;
                }
                else if (devRiskDto.getNum100()>5)
                {
                    score = score + 40;
                }
            }
            else if(devRiskDto.getType()==3 ){
                if(devRiskDto.getNum100()<=1)
                {
                    score = score + 30;
                }
                else if (devRiskDto.getNum100()<=3)
                {
                    score = score + 40;
                }
                else if (devRiskDto.getNum100()<=5)
                {
                    score = score + 45;
                }
                else if (devRiskDto.getNum100()>5)
                {
                    score = score + 50;
                }
            }
        }

         if(devRiskDto.getAlarmNum()!=null)
        {
            if(devRiskDto.getAlarmNum()<=1)
            {
                score = score + 0;
            }
            else if (devRiskDto.getAlarmNum()<=3)
            {
                score = score + 30;
            }
            else if (devRiskDto.getAlarmNum()<=5)
            {
                score = score + 40;
            }
            else if (devRiskDto.getAlarmNum()>5)
            {
                score = score + 50;
            }
        }
        score = score * m;

        map.put("score",score);
        map.put("riskLevel",riskLevelGas(score));
        return map;
    }

    //add by czdu on 2023-08-10
    @ApiOperation("获取燃气泄漏监测分级预警模型--1:一级预警;2:二级预警;3:三级预警;4:四级预警")
    @PostMapping("/getGasAlertLevel")
    public Map getGasAlertLevel(@RequestBody GasAlarmDto gasAlarmDto) {
        Map map = new HashMap();
        map.put("number",gasAlarmDto.getNumber());
        map.put("input",gasAlarmDto);
        if(gasAlarmDto.getAlarmDensity()!=null  && gasAlarmDto.getRiskLevel() !=null)
        {
            if(gasAlarmDto.getAlarmDensity().equals("3"))  //三级报警
            {
                if("1".equals(gasAlarmDto.getRiskLevel()))  // 一级风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                if("2".equals(gasAlarmDto.getRiskLevel()))  // 二级风险
                {
                    map.put("code","3");
                    map.put("name","三级预警");
                }
                if("3".equals(gasAlarmDto.getRiskLevel()))  // 一般风险
                {
                    map.put("code","4");
                    map.put("name","四级预警");
                }
                if("4".equals(gasAlarmDto.getRiskLevel()))  // 低风险
                {
                    map.put("code","4");
                    map.put("name","四级预警");
                }
            }
            else if(gasAlarmDto.getAlarmDensity().equals("2"))  //二级报警
            {
                if("1".equals(gasAlarmDto.getRiskLevel()))  // 一级风险
                {
                    map.put("code","1");
                    map.put("name","一级预警");
                }
                if("2".equals(gasAlarmDto.getRiskLevel()))  // 二级风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                if("3".equals(gasAlarmDto.getRiskLevel()))  // 一般风险
                {
                    map.put("code","3");
                    map.put("name","三级预警");
                }
                if("4".equals(gasAlarmDto.getRiskLevel()))  // 低风险
                {
                    map.put("code","4");
                    map.put("name","四级预警");
                }
            }
            else if(gasAlarmDto.getAlarmDensity().equals("1"))  //三级报警
            {
                if("1".equals(gasAlarmDto.getRiskLevel()))  // 一级风险
                {
                    map.put("code","1");
                    map.put("name","一级预警");
                }
                if("2".equals(gasAlarmDto.getRiskLevel()))  // 二级风险
                {
                    map.put("code","1");
                    map.put("name","一级预警");
                }
                if("3".equals(gasAlarmDto.getRiskLevel()))  // 一般风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                if("4".equals(gasAlarmDto.getRiskLevel()))  // 低风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        return map;
    }

    //add by czdu on 2023-08-10
    @ApiOperation("燃气安全监管模型")
    @PostMapping("/getGasSafefySupervise")
    public Map getGasSafefySupervise(@RequestBody GasSafetyDto gasSafetyDto) {
        Map map = new HashMap();
        map.put("number",gasSafetyDto.getNumber());
        map.put("input",gasSafetyDto);
        Double score = 0.0 ;

        if(gasSafetyDto.getOnlineRate()!=null)
        {
            if(gasSafetyDto.getOnlineRate()<50)
            {
                score = score + 10;
            }
            else if (gasSafetyDto.getOnlineRate()<80)
            {
                score = score + 25;
            }
            else if (gasSafetyDto.getOnlineRate()<90)
            {
                score = score + 45;
            }
            else if (gasSafetyDto.getOnlineRate()>=90)
            {
                score = score + 50;
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        if(gasSafetyDto.getAlarmRate()!=null)
        {
            if(gasSafetyDto.getAlarmRate()<3)
            {
                score = score + 50;
            }
            else if (gasSafetyDto.getAlarmRate()<8)
            {
                score = score + 35;
            }
            else if (gasSafetyDto.getAlarmRate()<15)
            {
                score = score + 20;
            }
            else if (gasSafetyDto.getAlarmRate()>=15)
            {
                score = score + 10;
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        map.put("score",score);
        return map;
    }

    //add by czdu on 2023-08-11
    @ApiOperation("消防用水报警监测预警分级模型")
    @PostMapping("/fireWater")
    public Map getFireWater(@RequestBody FireWaterAlarmDto fireWaterAlarmDto) {
        Map map = new HashMap();
        map.put("number",fireWaterAlarmDto.getNumber());
        map.put("input",fireWaterAlarmDto);

        if(fireWaterAlarmDto.getAlarmDuration()!=null)
        {
            //报警持续时间小于10分钟
            if(fireWaterAlarmDto.getAlarmDuration().equals("1")&&fireWaterAlarmDto.getAlarmNumOneWeek()!=null)
            {
                if(fireWaterAlarmDto.getAlarmNumOneWeek()>=3)  // 一级风险
                {
                    map.put("code","3");
                    map.put("name","三级预警");
                }
                else{
                    map.put("code","4");
                    map.put("name","四级预警");
                }
            }
            else if(fireWaterAlarmDto.getAlarmDuration().equals("2")&& fireWaterAlarmDto.getAlarmNumOneWeek()!=null)//报警持续时间大于等于10分钟，小于24小时
            {
                if(fireWaterAlarmDto.getAlarmNumOneWeek()>=3)  // 一级风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                else{
                    map.put("code","3");
                    map.put("name","三级预警");
                }
            }
            else if(fireWaterAlarmDto.getAlarmDuration().equals("3"))//报警持续时间大于等于24小时
            {

                    map.put("code","2");
                    map.put("name","二级预警");
            }
            else {
                map.put("msg","请输入正确的参数");
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        return map;
    }

    //add by czdu on 2023-08-11
    @ApiOperation("智慧用电报警监测预警分级模型")
    @PostMapping("/fireElectricity")
    public Map getFireElectricity(@RequestBody FireWaterAlarmDto fireWaterAlarmDto) {
        Map map = new HashMap();
        map.put("number",fireWaterAlarmDto.getNumber());
        map.put("input",fireWaterAlarmDto);

        if(fireWaterAlarmDto.getAlarmDuration()!=null)
        {
            //报警持续时间小于10分钟
            if(fireWaterAlarmDto.getAlarmDuration().equals("1")&&fireWaterAlarmDto.getAlarmNumOneWeek()!=null)
            {
                if(fireWaterAlarmDto.getAlarmNumOneWeek()>=3)  // 一级风险
                {
                    map.put("code","3");
                    map.put("name","三级预警");
                }
                else{
                    map.put("code","4");
                    map.put("name","四级预警");
                }
            }
            else if(fireWaterAlarmDto.getAlarmDuration().equals("2")&& fireWaterAlarmDto.getAlarmNumOneWeek()!=null)//报警时间持续小于1小时大于10分钟
            {
                if(fireWaterAlarmDto.getAlarmNumOneWeek()>=3)  // 一级风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                else{
                    map.put("code","3");
                    map.put("name","三级预警");
                }
            }
            else if(fireWaterAlarmDto.getAlarmDuration().equals("3"))//报警持续时间持续小于24小时大于1小时
            {
                if(fireWaterAlarmDto.getAlarmNumOneWeek()>=3)  // 一级风险
                {
                    map.put("code","1");
                    map.put("name","一级预警");
                }
                else{
                    map.put("code","2");
                    map.put("name","二级预警");
                }
            }
            else if(fireWaterAlarmDto.getAlarmDuration().equals("4"))//报警持续时间持续大于等于24小时
            {

                map.put("code","1");
                map.put("name","一级预警");
            }
            else {
                map.put("msg","请输入正确的参数");
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        return map;
    }

    //add by czdu on 2023-08-11
    @ApiOperation("火灾报警监测预警分级模型")
    @PostMapping("/fireAlarm")
    public Map getFireAlarm(@RequestBody FireAlarmDto fireAlarmDto) {
        Map map = new HashMap();
        map.put("number",fireAlarmDto.getNumber());
        map.put("input",fireAlarmDto);

        if(fireAlarmDto.getAlarmDuration()!=null)
        {
            //报警持续时间小于10分钟
            if(fireAlarmDto.getAlarmDuration().equals("1"))
            {
                    map.put("code","3");
                    map.put("name","三级预警");
            }
            else if(fireAlarmDto.getDeviceOnline()!=null)//报警时间持续小于1小时大于10分钟
            {
                if(fireAlarmDto.getDeviceOnline()==1)  // online
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                else{
                    map.put("code","1");
                    map.put("name","一级预警");
                }
            }
            else {
                map.put("msg","请输入正确的参数");
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        return map;
    }


    //add by czdu on 2023-08-11
    @ApiOperation("电梯困人预警分级模型")
    @PostMapping("/elevatorTrapped")
    public Map getElevatorTrapped(@RequestBody ElevatorTrappedDto elevatorTrappedDto) {
        Map map = new HashMap();
        map.put("number",elevatorTrappedDto.getNumber());
        map.put("input",elevatorTrappedDto);

        if(elevatorTrappedDto.getTrappedDuration()!=null)
        {
            //报警持续时间小于30分钟
            if(elevatorTrappedDto.getTrappedDuration().equals("1"))
            {
                map.put("code","3");
                map.put("name","三级预警");
            }
            else if(elevatorTrappedDto.getRiskLevel()!=null)//报警时间持续小于1小时大于10分钟
            {
                if(elevatorTrappedDto.getRiskLevel()==1)  // 一级风险
                {
                    map.put("code","1");
                    map.put("name","一级预警");
                }
                else if(elevatorTrappedDto.getRiskLevel()==2)  // 一级风险
                {
                    map.put("code","2");
                    map.put("name","二级预警");
                }
                else if(elevatorTrappedDto.getRiskLevel()==3||elevatorTrappedDto.getRiskLevel()==4)  // 一级风险
                {
                    map.put("code","3");
                    map.put("name","三级预警");
                }
                else {
                    map.put("code","1");
                    map.put("name","一级预警");
                }
            }
            else {
                map.put("msg","请输入正确的参数");
            }
        }
        else
        {
            map.put("msg","请输入正确的参数");
        }

        return map;
    }


    //add by czdu on 2023-08-11
    @ApiOperation("交通安全专项-交通安全监管")
    @PostMapping("/trafficSafety")
    public Map trafficSafety(@RequestBody TrafficSafetyDto trafficSafetyDto) {
        Map map = new HashMap();
        map.put("number",trafficSafetyDto.getNumber());
        map.put("input",trafficSafetyDto);
        Double score = 0.0 ;

        if(trafficSafetyDto.getOnlineRate()!=null)
        {
            //报警持续时间小于30分钟
            if(trafficSafetyDto.getOnlineRate().equals("1"))
            {
                score = score + 10;
            }
            else if(trafficSafetyDto.getOnlineRate().equals("2"))
            {
                score = score + 25;
            }
            else if(trafficSafetyDto.getOnlineRate().equals("3"))
            {
                score = score + 45;
            }
            else  if(trafficSafetyDto.getOnlineRate().equals("4")){
                score = score + 50;
            }
        }

        if(trafficSafetyDto.getRanking()!=null)
        {
            //报警持续时间小于30分钟
            if(trafficSafetyDto.getRanking().equals("1"))
            {
                score = score + 50;
            }
            else if(trafficSafetyDto.getRanking().equals("2"))
            {
                score = score + 35;
            }
            else if(trafficSafetyDto.getRanking().equals("3"))
            {
                score = score + 20;
            }
            else  if(trafficSafetyDto.getRanking().equals("4")){
                score = score + 10;
            }
        }
        map.put("score",score);

        return map;
    }


    //add by czdu on 2023-08-11
    @ApiOperation("桥梁安全专项-车辆拥堵预警")
    @PostMapping("/bridgeSafety")
    public Map bridgeSafety(@RequestBody BridgeSafetyDto bridgeSafetyDto) {
        Map map = new HashMap();
        map.put("number",bridgeSafetyDto.getNumber());
        map.put("input",bridgeSafetyDto);
        Double score = 0.0 ;

        if(bridgeSafetyDto.getN0()!=null&&bridgeSafetyDto.getN1()!=null)
        {
            Double rate = bridgeSafetyDto.getN1()/bridgeSafetyDto.getN0();

            if(rate>=0.9)
            {
                map.put("code","1");
                map.put("name","一级预警");
            }
            else if(rate>=0.7)
            {
                map.put("code","2");
                map.put("name","二级预警");
            }
            else if(rate>=0.5)
            {
                map.put("code","3");
                map.put("name","三级预警");
            }
            else
            {
                map.put("code","4");
                map.put("name","四级预警");
            }
        }
        else{
            map.put("msg","请输入正确的参数");
        }

        return map;
    }

    @ApiOperation("区域的行业风险值-消防")
    @PostMapping("/area/risk/xf")
    public Map jt(@RequestBody AreaRiskXF areaRiskXF) {
        Map map = new HashMap();
        map.put("input",areaRiskXF);

        Map map1 = new HashMap();
        map.put("number",areaRiskXF.getNumber());

        Double score = 0.0;
        Double a = 0.0;
        if(areaRiskXF.getTotal()!=null
                && areaRiskXF.getZdfxNum()!=null
                && areaRiskXF.getJdfxNum()!=null
                && areaRiskXF.getYbfxNum()!=null){
            //score = 100-(((qyhyfxDto.getTotal()-qyhyfxDto.getZdfxNum())*1.0)/qyhyfxDto.getTotal())*100.0;
            //区域电梯风险指数=（一级风险点数量+0.3二级风险点数量+0.1三级风险点数量)/所有风险点数量*100
            a = (areaRiskXF.getZdfxNum()+0.3*areaRiskXF.getJdfxNum()+0.1*areaRiskXF.getYbfxNum())/areaRiskXF.getTotal()*100.0;
            //score = score+30.0;
        }
        map1.put("A得分",Constant.DoubleFormat2(a));
        QyhyfxDto qyhyfxDto = new QyhyfxDto();
        qyhyfxDto.setJdfxNum(areaRiskXF.getJdfxNum());
        qyhyfxDto.setZdfxNum(areaRiskXF.getZdfxNum());
        qyhyfxDto.setYbfxNum(areaRiskXF.getYbfxNum());
        qyhyfxDto.setTotal(areaRiskXF.getTotal());

        map1.put("A明细",calcA(qyhyfxDto));

        Double b = 0.0;
        if(areaRiskXF.getAlertNum()!=null&&areaRiskXF.getAlertNum()==1)
        {
            b = b+40.0;
        }
        else {
            b = b+10.0;
        }

        score = a + b ;

        map.put("value",Constant.DoubleFormat2(score));
        map.put("level",riskLevel(score));
        //map1.put("风险数量",Constant.DoubleFormat2(a));
        map1.put("B 119因火灾出警的数量",Constant.DoubleFormat2(b));
        map.put("details",map1);

        return map;
    }

    @ApiOperation("场站风险评估模型")
    @PostMapping("/station")
    public Map station(@RequestBody Station station) {
        Map map = new HashMap();
        Map map1 = new HashMap();

        map.put("number",station.getNumber());

        Double score = calculateScore(station,stationDictMap,"ST");
        map.put("score",score);
        map.put("level",this.riskLevelST(score));

        Double score1 = calculateScore(station,stationDictMap1,"ST");
        map1.put("是否安装燃气监测报警器",score1);

        score1 = calculateScore(station,stationDictMap2,"ST");
        map1.put("是否编制应急预案",score1);

        score1 = calculateScore(station,stationDictMap3,"ST");
        map1.put("是否开展应急演练",score1);
        score1 = calculateScore(station,stationDictMap4,"ST");
        map1.put("是否开展隐患排查并上报",score1);

        score1 = calculateScore(station,stationDictMap5,"ST");
        map1.put("近3年是否接受过安全处罚",score1);


        map.put("details",map1);
        map.put("input",station);

        return map;
    }

    @ApiOperation("场站综合风险评估模型")
    @PostMapping("/stationComprehensive")
    public Map stationComprehensive(@RequestBody Station station) {
        Map map = new HashMap();
        Map map1 = new HashMap();

        map.put("number",station.getNumber());

        Double score = calculateScore(station,stationComprehensiveDictMap,"ZHST");
        map.put("score",score);
        map.put("level",this.riskLevelST(score));

        Double score1 = calculateScore(station,stationComprehensiveDictMap1,"ZHST");
        map1.put("是否安装燃气监测报警器",score1);

        score1 = calculateScore(station,stationComprehensiveDictMap2,"ZHST");
        map1.put("是否编制应急预案",score1);

        score1 = calculateScore(station,stationComprehensiveDictMap3,"ZHST");
        map1.put("是否开展应急演练",score1);
        score1 = calculateScore(station,stationComprehensiveDictMap4,"ZHST");
        map1.put("是否开展隐患排查并上报",score1);

        score1 = calculateScore(station,stationComprehensiveDictMap5,"ZHST");
        map1.put("近3年是否接受过安全处罚",score1);

        score1 = calculateScore(station,stationComprehensiveDictMap6,"ZHST");
        map1.put("周边150米范围内是否有建筑物",score1);


        map.put("details",map1);
        map.put("input",station);

        return map;
    }


    @ApiOperation("企业综合评价模型")
    @PostMapping("/enterpriseComprehensive")
    public Map enterpriseComprehensive(@RequestBody Enterprise enterprise) {
        Map map = new HashMap();
        Map map1 = new HashMap();

        map.put("number",enterprise.getNumber());

        Double score = calculateScore(enterprise, enterpriseComprehensiveDictMap,"EN");
        map.put("score",score);
        map.put("level",this.evaluateLevel(score));

        Double score1 = calculateScore(enterprise,enterpriseComprehensiveDictMap1,"EN");
        map1.put("是否安装燃气监测报警器",score1);

        score1 = calculateScore(enterprise,enterpriseComprehensiveDictMap2,"EN");
        map1.put("是否编制应急预案",score1);

        score1 = calculateScore(enterprise,enterpriseComprehensiveDictMap3,"EN");
        map1.put("是否开展应急演练",score1);
        score1 = calculateScore(enterprise,enterpriseComprehensiveDictMap4,"EN");
        map1.put("是否开展隐患排查并上报",score1);

        score1 = calculateScore(enterprise,enterpriseComprehensiveDictMap5,"EN");
        map1.put("近3年是否接受过安全处罚",score1);



        map.put("details",map1);
        map.put("input",enterprise);

        return map;
    }


    private String evaluateLevel(Double score){
        String level = "优秀";
        if(score>=80){
            level = "优秀";
        }else if(score>=55){
            level = "良好";
        }else if(score>=30){
            level = "一般";
        }else{
            level = "较差";
        }
        return level;
    }



/*
    @ApiOperation("管线耦合风险模型")
    @PostMapping("/pipelineCouplingRisk")
    public Map pipelineCouplingRisk(@RequestBody PipelineCouplingRisk pipelineCouplingRisk) {
        Map map = new HashMap();
        Map map1 = new HashMap();
        Integer hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_1;
        String reason = Constant.HIDDEN_TROUBLE_LEVEL_1;
        String level = Constant.HIDDEN_TROUBLE_LEVEL_1;

        map.put("number",pipelineCouplingRisk.getNumber());

        if(pipelineCouplingRisk.getPressureLevel() != null && pipelineCouplingRisk.getPressureLevel()== 1) //低压
        {
           if(pipelineCouplingRisk.getGapBetweenGasDrainage() != null && pipelineCouplingRisk.getGapBetweenGasDrainage() <= 1.0)
           {
               hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
               level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
               reason = "燃气管道与排水管道的水平距离小于或等于1.0米";
           }

            if(pipelineCouplingRisk.getGapBetweenGasPower() != null && pipelineCouplingRisk.getGapBetweenGasPower() <= 1.0)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与电力管道的水平距离小于或等于1.0米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasComm() != null && pipelineCouplingRisk.getGapBetweenGasComm() <= 1.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_3)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_3;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_3;
                    reason = "燃气管道与通信线缆的水平距离小于或等于1.0米";
                }

            }

            if(pipelineCouplingRisk.getGapBetweenGasWater() != null && pipelineCouplingRisk.getGapBetweenGasWater() <= 0.5)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与供水管道的水平距离小于或等于0.5米";
                }
            }

            if(pipelineCouplingRisk.getGapBetweenGasHeat() != null && pipelineCouplingRisk.getGapBetweenGasHeat() <= 1.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与热力管道的水平距离小于或等于1.0米";
                }
            }
        }
        else if(pipelineCouplingRisk.getPressureLevel() != null && pipelineCouplingRisk.getPressureLevel()== 2) //中压
        {
            if(pipelineCouplingRisk.getGapBetweenGasDrainage() != null && pipelineCouplingRisk.getGapBetweenGasDrainage() <= 1.2)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与排水管道的水平距离小于或等于1.2米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasPower() != null && pipelineCouplingRisk.getGapBetweenGasPower() <= 1.0)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与电力管道的水平距离小于或等于1.0米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasComm() != null && pipelineCouplingRisk.getGapBetweenGasComm() <= 1.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_3)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_3;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_3;
                    reason = "燃气管道与通信线缆的水平距离小于或等于1.0米";
                }

            }

            if(pipelineCouplingRisk.getGapBetweenGasWater() != null && pipelineCouplingRisk.getGapBetweenGasWater() <= 0.5)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与供水管道的水平距离小于或等于0.5米";
                }
            }

            if(pipelineCouplingRisk.getGapBetweenGasHeat() != null && pipelineCouplingRisk.getGapBetweenGasHeat() <= 1.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与热力管道的水平距离小于或等于1.0米";
                }
            }
        }
        else if(pipelineCouplingRisk.getPressureLevel() != null && pipelineCouplingRisk.getPressureLevel()== 3) //高压 A
        {
            if(pipelineCouplingRisk.getGapBetweenGasDrainage() != null && pipelineCouplingRisk.getGapBetweenGasDrainage() <= 2.0)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与排水管道的水平距离小于或等于2.0米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasPower() != null && pipelineCouplingRisk.getGapBetweenGasPower() <= 1.5)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与电力管道的水平距离小于或等于1.5米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasComm() != null && pipelineCouplingRisk.getGapBetweenGasComm() <= 1.5)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_3)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_3;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_3;
                    reason = "燃气管道与通信线缆的水平距离小于或等于1.5米";
                }

            }

            if(pipelineCouplingRisk.getGapBetweenGasWater() != null && pipelineCouplingRisk.getGapBetweenGasWater() <= 1.5)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与供水管道的水平距离小于或等于1.5米";
                }
            }

            if(pipelineCouplingRisk.getGapBetweenGasHeat() != null && pipelineCouplingRisk.getGapBetweenGasHeat() <= 2.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与热力管道的水平距离小于或等于2.0米";
                }
            }
        }
        else if(pipelineCouplingRisk.getPressureLevel() != null && pipelineCouplingRisk.getPressureLevel()== 4) //高压 B
        {
            if(pipelineCouplingRisk.getGapBetweenGasDrainage() != null && pipelineCouplingRisk.getGapBetweenGasDrainage() <= 1.5)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与排水管道的水平距离小于或等于1.5米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasPower() != null && pipelineCouplingRisk.getGapBetweenGasPower() <= 1.0)
            {
                hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_4;
                level =  Constant.HIDDEN_TROUBLE_LEVEL_4;
                reason = "燃气管道与电力管道的水平距离小于或等于1.0米";
            }

            if(pipelineCouplingRisk.getGapBetweenGasComm() != null && pipelineCouplingRisk.getGapBetweenGasComm() <= 1.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_3)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_3;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_3;
                    reason = "燃气管道与通信线缆的水平距离小于或等于1.0米";
                }

            }

            if(pipelineCouplingRisk.getGapBetweenGasWater() != null && pipelineCouplingRisk.getGapBetweenGasWater() <= 1.0)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与供水管道的水平距离小于或等于1.0米";
                }
            }

            if(pipelineCouplingRisk.getGapBetweenGasHeat() != null && pipelineCouplingRisk.getGapBetweenGasHeat() <= 1.5)
            {
                if(hiddenTroubleLevel < Constant.HIDDEN_TROUBLE_NO_2)
                {
                    hiddenTroubleLevel = Constant.HIDDEN_TROUBLE_NO_2;
                    level =  Constant.HIDDEN_TROUBLE_LEVEL_2;
                    reason = "燃气管道与热力管道的水平距离小于或等于1.5米";
                }
            }
        }
        else {
            map.put("msg","请输入正确的参数！");
        }
        map.put("hiddenTroubleLevel",level);
        map.put("hiddenTroubleReason",reason);
        map.put("input",pipelineCouplingRisk);

        return map;
    }
*/

    public static void main(String[] args) {
        /*JtDto jtDto = new JtDto();
        jtDto.setBjcz("1");
        jtDto.setCllx("2");
        jtDto.setQxzk("2");
        jtDto.setYshx("1");
        jtDto.setWhps("1");
        jtDto.setSzlw("1");
        jtDto.setClsz("1");
        jtDto.setSfaz("1");
        jtDto.setJksf("1");
        jtDto.setYshx("1");
        jtDto.setYshx("1");
        RiskEvaluateController risk = new RiskEvaluateController();
        Double score = risk.calculateScore(jtDto,jtDictMap,"DT");*/
        Integer score = 0;
        score += 1;
        System.out.println(score);
    }
}
